﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ShSoft.Common.PoweredByLee;
using ShSoft.Infrastructure.EntityBase;

namespace WarehouseSystem.Domain.Entities
{
    /// <summary>
    /// 仓库
    /// </summary>
    public class Repertory : AggregateRootEntity
    {
        #region  # 构造器

        #region 01.无参构造器
        /// <summary>
        /// 无参构造器
        /// </summary>
        protected Repertory()
        {
        }

        #endregion

        #region 02.创建仓库构造器

        /// <summary>
        /// 创建仓库
        /// </summary>
        /// <param name="StorageAreas"></param>
        /// <param name="name"></param>
        public Repertory(ICollection<StorageArea> StorageAreas, string name)
            : this()
        {
            this.Name = name;
            if (StorageAreas.Count > 0)
            {
                this.StorageAreas.AddRange(StorageAreas);
            }
            //初始化关键字
            this.InitKeywords();
        }

        #endregion

        #endregion

        #region # 属性

        #region 导航属性 - 仓储区域集 —— ICollection<StorageArea> StorageAreas
        /// <summary>
        /// 导航属性 - 仓储区域集
        /// </summary>
        public virtual ICollection<StorageArea> StorageAreas { get; private set; }
        #endregion

        #endregion

        #region 方法

        //public

        #region 获取商品信息 ——



        #endregion

        //private

        #region 初始化关键字 —— void InitKeywords()
        /// <summary>
        /// 初始化关键字
        /// </summary>
        private void InitKeywords()
        {
            StringBuilder keywordsBuilder = new StringBuilder();
            keywordsBuilder.Append(base.Number);
            keywordsBuilder.Append(base.Name);

            base.SetKeywords(keywordsBuilder.ToString());
        }
        #endregion

        #endregion
    }
}
